## Overview

This package replicates the analysis in Cajner, Coglianese, and Montes (forthcoming). All of the analysis can be run from the stata file code/main.do.

## Data Availability and Provenance Statements

All data used in the paper's analysis are included in this replication package. The data come from public sources, described below.

### Statement about Rights

- [x] I certify that the author(s) of the manuscript have legitimate access to and permission to use the data used in this manuscript.
- [x] I certify that the author(s) of the manuscript have documented permission to redistribute/publish the data contained within this replication package. Appropriate permission are documented in the [LICENSE.txt](LICENSE.txt) file.


### License for Data

The data are licensed under a Creative Commons/CC-BY-NC license. See LICENSE.txt for details.


### Summary of Availability

- [x] All data **are** publicly available.
- [ ] Some data **cannot be made** publicly available.
- [ ] **No data can be made** publicly available.

### Details on each Data Source

The data sources used in the analysis are included in the raw/ folder:

| Data Name                                   | Data File(s)                              | Location | Provided | Source           |
|---------------------------------------------|-------------------------------------------|----------|----------|------------------|
| Current Population Survey                   | cps_extract.dta                           | raw/     | TRUE     | BLS/Census       |
| Gross State Product                         | output_data_haver.dta                     | raw/     | TRUE     | BEA via Haver    |
| Gross State Product by industry             | gsp_haver_naics.dta and gsp_haver_sic.dta | raw/     | TRUE     | BEA via Haver    |
| GDP deflators                               | haver_deflators.dta                       | raw/     | TRUE     | BEA via Haver    |
| Resident population by age                  | haver_population_age.dta                  | raw/     | TRUE     | Census via Haver |
| Local Area Unemployment Statistics          | lausdatafinal.dta                         | raw/     | TRUE     | BLS              |
| National labor force participation rate 16+ | lfpr_and_ageadj.dta                       | raw/     | TRUE     | BLS              |

## Computational requirements

All of the code used in the analysis is included, and can be run on a standard machine with Stata, see below for details.

### Software Requirements

The analysis uses Stata code, last run in Stata/MP 18.0. All packages used are included in code/ado. Portions of the code use bash scripting, which may require Linux.

### Controlled Randomness

- [x] Random seed is set at line 83 of program placebo_test.do, line 87 of program var_vs_lp.do, and line 35 of computing_ses_for_generated_outcome.do.
- [ ] No Pseudo random generator is used in the analysis described here.

### Memory, Runtime, Storage Requirements

#### Summary

Approximate time needed to reproduce the analyses on a standard (2025) desktop machine:

- [ ] <10 minutes
- [ ] 10-60 minutes
- [ ] 1-2 hours
- [x] 2-8 hours
- [ ] 8-24 hours
- [ ] 1-3 days
- [ ] 3-14 days
- [ ] > 14 days

Approximate storage space needed:

- [ ] < 25 MBytes
- [ ] 25 MB - 250 MB
- [ ] 250 MB - 2 GB
- [x] 2 GB - 25 GB
- [ ] 25 GB - 250 GB
- [ ] > 250 GB

- [ ] Not feasible to run on a desktop machine, as described below.

#### Details

The code was last run on a linux machine with 4 cpus and 64 GB of RAM, taking about 7 hours to run completely. The total storage space used was just under 5 GB.


## Description of programs/code

All of the programs are run by main.do:
 - paths.do sets up the environment and creates global variables used by the code files. It is recommended to run this before each code file (it is called at the top of each file).
 - Several programs set up the main datasets used in the analysis. These are create_all_cps_vintages.do, load_output_data.ado, load_bartik_instrument.ado, and haver_population_age.do. create_all_cps_vintages.do takes much longer to run than the other files and uses higher computational resources, since it is creating state-level panel series from the CPS microdata.
 - The main estimation for the paper is done in estimate_irfs_demo.do, estimate_irfs_flows.do, estimate_irfs_reasons.do, estimate_irfs_pop.do, and first_stage_regs.do. These files run local projections regressions and save the estimation results in output/**/ster.
 - Robustness checks are conducted in effect_heterogeneity.do, test_of_shape_similarity.do, placebo_test.do, var_vs_lp.do, bartik_decomp.do, iv_robustness.do, and computing_ses_for_generated_outcome.do. Of these, most run fairly quickly, but placebo_test.do, var_vs_lp.do, and computing_ses_for_generated_outcome.do each take much longer than average since they are iterating over many repeated estimations.
 - After all estimation is done, the graphs from the paper are created in graphs_for_paper.do, saved to output/graphs_for_paper.

### License for Code

The code is licensed under an MIT license. See [LICENSE.txt](LICENSE.txt) for details.

## Instructions to Replicators

Before running any code, you will need to edit line 2 of paths.do to point to the folder where you have unpacked the replication package. Make sure that paths.do runs correctly before proceeding.

All of the code can be run with main.do, which will sequentially run each part of the analysis. If there are any errors or execution stops for any reason, it is recommended to run main.do again from the top since later code files will depend on the results of earlier code files.

## List of tables and programs


> INSTRUCTIONS: Your programs should clearly identify the tables and figures as they appear in the manuscript, by number. Sometimes, this may be obvious, e.g. a program called "`table1.do`" generates a file called `table1.png`. Sometimes, mnemonics are used, and a mapping is necessary. In all circumstances, provide a list of tables and figures, identifying the program (and possibly the line number) where a figure is created.
>
> NOTE: If the public repository is incomplete, because not all data can be provided, as described in the data section, then the list of tables should clearly indicate which tables, figures, and in-text numbers can be reproduced with the public material provided.

The provided code reproduces:

- [x] All numbers provided in text in the paper
- [x] All tables and figures in the paper
- [ ] Selected tables and figures in the paper, as explained and justified below.


| Figure/Table #       | Program             | Line Number | Output file             | Note           |
|----------------------|---------------------|-------------|-------------------------|----------------|
| Figure 1             | graphs_for_paper.do | 859         | productivity.pdf        |                |
| Figure 2             | graphs_for_paper.do | 99          | main_result_figure.pdf  |                |
| Figure 3             | graphs_for_paper.do | 150         | great_recession.pdf     |                |
| Figure 4             | graphs_for_paper.do | 199         | reasons.pdf             |                |
| Figure 5             | graphs_for_paper.do | 270         | flows.pdf               |                |
| Figure 6             | graphs_for_paper.do | 313         | demographics.pdf        |                |
| Figure 7             | graphs_for_paper.do | 374         | age_migration_josh.pdf  |                |
| Figure A.1           | graphs_for_paper.do | 439         | prime_age.pdf           |                |
| Figure A.2           | graphs_for_paper.do | 505         | old_and_young.pdf       |                |
| Figure A.3           | graphs_for_paper.do | 571         | men_and_women.pdf       |                |
| Figure A.4           | graphs_for_paper.do | 637         | education.pdf           |                |
| Figure A.5           | graphs_for_paper.do | 732         | race.pdf                |                |
| Figure B.1           | graphs_for_paper.do | 797         | shock_heterogeneity.pdf |                |
| Table B.1            | bartik_decomp.do    | 111,119,127 | decomp.xlsx             |                |
| Figure C.1 panel (a) | graphs_for_paper.do | 892         | robustness_figure.pdf   |                |
| Figure C.1 panel (b) |                     |             |                         | See note below |
| Figure D.1           | graphs_for_paper.do | 958         | ur_demographics.pdf     |                |
| Figure D.2           | graphs_for_paper.do | 996         | controls_robustness.pdf |                |
| Figure D.3           | graphs_for_paper.do | 1049        | reasons_by_group.pdf    |                |
| Table D.1            | iv_robustness.do    | 81          | robust_fstats.tex       |                |


Note: For Figure C.1 panel (b), the numbers in the table were manually entered based on values reported in the log files. For Section I, the numbers were copied from the log file for placebo_test.do, and for Section II, the numbers were copied from the log file for var_vs_lp.do.
